package com.scrcu.cloud.wechat.home.endpoint.customer.controller;

import com.scrcu.cloud.wechat.home.endpoint.common.model.RestResponse;
import com.scrcu.cloud.wechat.home.endpoint.customer.service.ICityService;
import com.scrcu.cloud.wechat.home.endpoint.customer.service.IOtherService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @auther: 刘思良
 * @date: 2024/11/25 16:57
 * @description: 普通的rest接口调用方式
 * @version: 1.0.0
 */

@Slf4j
@RestController
@RequestMapping("/institution")
public class InstController {
    @Resource
    private ICityService iCityService;

    @Resource
    private IOtherService iAtmService;

    @GetMapping("/getByCityCountyId")
    @ResponseBody
    public RestResponse getByCityCountyId(@RequestParam("city") String city_id, @RequestParam("county") String county_id){
        return iCityService.getByCity(city_id.toString(),county_id.toString());
    }

    @PostMapping("/getAllByAreaName")
    public RestResponse getAllByAreaName(@RequestParam("cityname") String cityname,
                                         @RequestParam("areaname") String areaname){
        return iCityService.getAllByAreaName(cityname,areaname);
    }

    @GetMapping("/getByCityName")
    @ResponseBody
    public RestResponse getByCityName(@RequestParam("cityname") String cityname){
        return iCityService.getByCityName(cityname);
    }

    @GetMapping("/getAllData")
    @ResponseBody
    public RestResponse getByCityName(){
        return iCityService.getAllData();
    }

    @GetMapping("/getByInstName")
    @ResponseBody
    public RestResponse getByInstName(@RequestParam("InstName") String InstName){
        return iCityService.getByInstName(InstName);
    }
//    ATM
    @GetMapping("/getATMByCityName")
    @ResponseBody
    public RestResponse getATMByCityName(@RequestParam("cityname") String cityname){
        return iAtmService.getATMByCityName(cityname);
    }
//    助农取款点
    @GetMapping("/getHelpByCityName")
    @ResponseBody
    public RestResponse getHelpByCityName(@RequestParam("cityname") String cityname){
        return iAtmService.getHelpByCityName(cityname);
    }
//    农宗站
    @GetMapping("/getServiceByCityName")
    @ResponseBody
    public RestResponse getServiceByCityName(@RequestParam("cityname") String cityname){
        return iAtmService.getServiceByCityName(cityname);
    }
    //商户
    @GetMapping("/getShopByCityName")
    @ResponseBody
    public RestResponse getShopByCityName(@RequestParam("cityname") String cityname){
        return iAtmService.getShopByCityName(cityname);
    }
}
